#pragma once

using namespace PolyLineGraph2;
namespace PolyLineGraph2
{
	template<typename T>
	ref class ListCollection
	{
	private:
		std::vector<T> innerList;
	public:
		property int Size
		{
			int get() { return Count();};
		}
		int Count()
		{
			return innerList.size();
		}

		void Append(T t)
		{
			innerList.push_back(t);
		}

		void Add(T t)
		{
			innerList.push_back(t);
		}
		void Insert(int index, T t)
		{
			innerList.insert(innerList.begin() + index, 1, t);
		}

		T GetAt(int index)
		{
			return innerList.at(index);
		}

		int IndexOf(T t)
		{
			for(int i = 0; i < innerList.size(); i++)
			{
				if(innerList.at(i) == t)
				{
					return i;
				}
			}
			return -1;
		}

		void RemoveAt(int index)
		{
			auto deleteItem = innerList.begin() + index;
			innerList.erase(deleteItem);
		}

		void Swap(int source, int des)
		{
			std::swap(innerList[source],innerList[des]);
		}

		void Move(int source,int des)
		{
			T t=innerList.at(source);
			innerList.erase(innerList.begin()+source);
			innerList.insert(innerList.begin()+des,t);
		}

		T Last()
		{
			return innerList.at(innerList.size()-1);
		}

		void Clear()
		{
			innerList.clear();
		}

		void Set(int index,T t)
		{
			innerList[index]=t;
		}
	};
};

